package com.xsx.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLOutput;

public class RequestAPIServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //i.getRequestURI()   获取请求的资源路径
        System.out.println("uri>>"+ req.getRequestURI());
        //ii.getRequestURL()  获取请求的统一资源定位符（绝对路径>
        System.out.println("url>>"+ req.getRequestURL());
        //iii.getRemoteHost() 获取客户端的ip地址
        System.out.println("ip>>"+ req.getRemoteHost());
        //iv.getHeader()      获取请求头
        System.out.println(req.getHeader("Accept-Language"));
        //vii.getMethod( )    获取请求的方式GET3 POST
        System.out.println("请求方式："+ req.getMethod());
    }

    }

